import request from '@/utils/request'

/**
 * 查询报表
 * @param pageNum
 * @param pageSize
 */
const getList = function(pageNum, pageSize, params) {
  let pa = getParam(params)
  console.log(pa)
  return request({
    // url: '/sysOrder/getStatistics?pageNum=' + pageNum + '&pageSize=' + pageSize + '&' + pa,
    url: '/sysOrder/getServesStatis?pageNum=' + pageNum + '&pageSize=' + pageSize + '&' + pa,
    method: 'get',
    data: params
  })
}
/**
 * 查询报价列表
 * @param pageNum
 * @param pageSize
 */
const getQuotation = function(custId, dateType) {
  return request({
    url: '/sysOrder/getQuotationRecord?custId=' + custId + '&dateType=' + dateType,
    method: 'get',
    data: {}
  })
}
/**
 * 查询待支付列表
 * @param pageNum
 * @param pageSize
 */
const getUnOrders = function(mobile, dateType) {
  return request({
    url: '/sysOrder/getUnOrders?mobile=' + mobile + '&dateType=' + dateType,
    method: 'get',
    data: {}
  })
}
export const statis = {
  getList: getList,
  getQuotation: getQuotation,
  getUnOrders: getUnOrders
}
/**
 * 参数处理
 * @param params
 */
const getParam = function(params) {
  let ret = ''
  for (const it in params) {
    ret += encodeURIComponent(it) + '=' + encodeURIComponent(params[it]) + '&'
  }
  return ret.substr(0 ,ret.length - 1)
}
